﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace DisplayWord
{
    public partial class RenameFile : Form
    {
        public RenameFile()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string path = @"c:\NVGIOI\Ebooks\Minnano\Audio\";
            string[] filePaths = Directory.GetFiles(path,
                                            "*.mp3", SearchOption.AllDirectories);
            for (int i = 0; i < filePaths.Length; i++)
            {
                string[] str = filePaths[i].Split('-');
                System.IO.File.Move(filePaths[i], str[0].TrimEnd(' ') +"-"+
                    int.Parse(str[1]).ToString().PadLeft(2,'0')+"-"+str[2].TrimStart(' '));
            }

            MessageBox.Show("ok");
        }
    }
}
